package com.googlecode.payroll.util

import java.text.*

class DateUtil {

    static def startOfMonth(String month) {
        new SimpleDateFormat("yyyyMMdd").parse(month + "01")
    }

    static def endOfMonth(String month) {
        Calendar lastDay = new GregorianCalendar()
        lastDay.setTime(startOfMonth(month))
        int lastDayOfMonth = lastDay.getActualMaximum(Calendar.DAY_OF_MONTH)
        new SimpleDateFormat("yyyyMMdd").parse(month + lastDayOfMonth)
    }
}
